
<div class="row">
    <div class="col-md-12">
        <div class="widget stacked">
            <div class="widget-content">
            <div class="box-body">
                <!-- <div class="row"> -->
                    <div class="col-md-3 col-sm-4">
                        <!-- BOXES are complex enough to move the .box-header around.
                             This is an example of having the box header within the box body -->
                        <div class="box-header">
                            <i class="icon icon-inbox"></i>
                            <h3 class="box-title"><?php echo $this->l('INBOX'); ?></h3>
                        </div>
                        <!-- compose message btn -->
                        <a class="btn btn-block btn-primary" data-toggle="modal" data-target="#compose-modal"><i class="icon icon-pencil"></i> <?php echo $this->l('Compose Message'); ?></a>
                        <!-- Navigation - folders-->
                        <div style="margin-top: 15px;">
                            <ul class="nav nav-pills nav-stacked">
                                <li class="header"><?php echo $this->l('Folders'); ?></li>
                                <li class="active"><a href="#"><i class="icon icon-inbox"></i> <?php echo $this->l('Inbox'); ?> (14)</a></li>
                                <li><a href="#"><i class="icon icon-pencil-square-o"></i> <?php echo $this->l('Drafts'); ?></a></li>
                                <li><a href="#"><i class="icon icon-mail-forward"></i> <?php echo $this->l('Sent'); ?></a></li>
                                <li><a href="#"><i class="icon icon-star"></i> <?php echo $this->l('Starred'); ?></a></li>
                                <li><a href="#"><i class="icon icon-folder"></i> <?php echo $this->l('Junk'); ?></a></li>
                            </ul>
                        </div>
                    </div><!-- /.col (LEFT) -->
                    <div class="col-md-9 col-sm-8">
                        <div class="row pad">
                            <div class="col-sm-6">
                                <label style="margin-right: 10px;">
                                    <input type="checkbox" id="check-all"/>
                                </label>
                                <!-- Action button -->
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                        <?php echo $this->l('Action'); ?> <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#"><?php echo $this->l('Mark as read'); ?></a></li>
                                        <li><a href="#"><?php echo $this->l('Mark as unread'); ?></a></li>
                                        <li class="divider"></li>
                                        <li><a href="#"><?php echo $this->l('Move to junk'); ?></a></li>
                                        <li class="divider"></li>
                                        <li><a href="#"><?php echo $this->l('Delete'); ?></a></li>
                                    </ul>
                                </div>

                            </div>
                            <div class="col-sm-6 search-form">
                                <form action="#" class="text-right">
                                    <div class="input-group">                                                            
                                        <input type="text" class="form-control input-sm" placeholder="Search">
                                        <div class="input-group-btn">
                                            <button type="submit" name="q" class="btn btn-sm btn-primary"><i class="icon icon-search"></i></button>
                                        </div>
                                    </div>                                                     
                                </form>
                            </div>
                        </div><!-- /.row -->

                        <div class="table-responsive">
                            <!-- THE MESSAGES -->
                            <table class="table table-bordered">
                                <?php foreach ($messages as $message) { ?>
                                <tr <?php  if ($message->readed === 0) { echo 'class="unread"'; } ?>>
                                    <td class="small-col"><input type="checkbox" /></td>
                                    <td class="small-col"><i class="icon icon-star"></i></td>
                                    <td class="name"><a href="<?php echo site_url('Doctor/Patient/viewPatient/'.$message->patient_id) ?>"><?php echo $message->patient_name; ?></a></td>
                                    <td class="subject"><?php  echo $message->context; ?></td>
                                    <td class="message"><a href="<?php echo site_url('Doctor/Message/read/'.$message->id_message) ?>"><?php  echo $message->message; ?></a></td>
                                    <td class="time">
                                        <?php 
                                            $date = date_create_from_format('Y-m-d H:i:s', $message->date_add);
                                            echo date_format($date, 'd F Y').' at ';
                                            echo date_format($date, 'H:i A'); 
                                        ?>
                                    </td>
                                </tr>
                                <?php } ?>
                            </table>
                        </div><!-- /.table-responsive -->
                    </div><!-- /.col (RIGHT) -->
                <!--</div> /.row -->
            </div><!-- /.box-body -->
            <div class="box-footer clearfix">
                <div class="pull-right">
                    <small>Showing 1-12/1,240</small>
                    <button class="btn btn-xs btn-primary"><i class="icon icon-caret-left"></i></button>
                    <button class="btn btn-xs btn-primary"><i class="icon icon-caret-right"></i></button>
                </div>
            </div><!-- box-footer -->
            </div><!-- box-content -->
        </div><!-- /.box -->
    </div><!-- /.col (MAIN) -->
</div>